package com.red.star.macalline.data.mappers;

import com.red.star.macalline.data.core.base.MyMapper;
import com.red.star.macalline.data.entity.GroupFans;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.mongodb.core.aggregation.ArrayOperators;

import java.util.List;

public interface GroupFansMapper extends MyMapper<GroupFans> {

    @Select(value = "select * from t_group_fans t where t.employee_id = #{employeeId}")
    public List<GroupFans> findGroupFansByEmployeeId(Integer employeeId);

    @Delete(value = "delete from t_group_fans where group_id = #{groupId}")
    public void deleteByGroupId(Integer groupId);

    @Delete(value = "delete from t_group_fans where group_id =#{groupId} and employee_id = #{employeeId}")
    void deleteByGroupIdAndEmployeeId(@Param("groupId") Integer groupId, @Param("employeeId") Integer employeeId);

    @Delete(value = "delete from t_group_fans where group_id =#{groupId} and b_fans_id = #{fansId}")
    void deleteByGroupIdAndFansId(@Param("groupId") Integer groupId, @Param("fansId") Integer fansId);

    @Select(value = "select * from t_group_fans where group_id =#{groupId}")
    List<GroupFans> getGroupFansByGroupId(Integer groupId);

    @Select(value = "select * from t_group_fans t where t.b_fans_id = #{fansId}")
    public List<GroupFans> findGroupFansByFansId(Integer fansId);
}
